package com.fileStorageService.dubbo.exposureInterface;

import com.alibaba.dubbo.config.annotation.Service;
import com.dubboInterface.merchant.fileStorageInterface.FileStore;
import com.fileStorageService.service.DownFileService;
import com.fileStorageService.service.UploadFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.File;

@Service
@Component
public class FileStoreInterface implements FileStore {
    @Autowired
    private DownFileService downFileService;
    @Autowired
    private UploadFileService uploadFileService;

    @Override
    public File fetchFile(String fileName) {
        return downFileService.downloadFile(fileName);
    }

    @Override
    public boolean storeFile(String fileName, byte[] fileContent) {
        return uploadFileService.uploadFile(fileName, fileContent);
    }
}
